package com.travelsky.app.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.travelsky.app.frame.FrameConst;
import com.travelsky.app.persistence.User;
/**
 * 
* @ClassName: LoginInterceptor
* @Description: 对用户session过期后回退操作的拦截
* @author zgch
* @date 2011-5-23 上午11:11:59
*
 */
public class LoginInterceptor implements Interceptor {

	private static final long serialVersionUID = 1773170091539917036L;
	private static final String FORBIDDEN = "authFail";
	public void destroy() {

	}

	public void init() {
	}

	public String intercept(ActionInvocation actionInvocation) throws Exception {
		Map session = actionInvocation.getInvocationContext().getSession(); 
		User sysUserVO=(User) session.get(FrameConst.USER_INFO_BACK);
		if(sysUserVO==null){
			 return FORBIDDEN; 
		}
			return actionInvocation.invoke(); 
	}
}
